<template>
	<view class="u-padding-30 ">
		<u-swiper :autoplay="false" v-if="list.length" @change="swiper" :current="current" height="300" :list="list" name="cover"
			:effect3d="true"></u-swiper>
		<view class="u-type-success u-font-weight u-font-40 u-margin-top-10">
			￥{{detail.price}}
		</view>
		<view class="u-margin-top-20">
			<view>权益说明:</view>
			<view class="u-type-info u-margin-top-10">{{detail.remark}}</view>


		</view>
		
		
		<view class="" style="position: fixed;bottom: 20rpx;width:90%;left: 5%;">
			<u-button @click="add" shape="circle" type="primary">充值</u-button>
		</view>
		
		
		<u-toast ref="uToast" />
		

	</view>
</template>

<script>
import wxpay from '@/common/wxpay.js';
	
	export default {
		data() {
			return {
				list: [],
				current: 0,
				detail: ''
			}
		},
		onLoad() {
			this.name()
		},
		methods: {
			add(){
				
				this.$u.post('/indent/vip', {
				   id:this.list[this.current].id
				}).then(res => {
					const wx = new wxpay(res);
					
												wx.pay().then(res => {
					
													this.$refs.uToast.show({
					
														title: '充值成功',
					
														type: 'success',
					
														back: true
					
													})
					
												}).catch(err => {
					
					
					
												})
				}).catch(err => {})
				
			},
			swiper(e) {
				this.current = e;
				this.detail = this.list[e]
			},
			name() {
				this.$u.post('/index/combo', {

				}).then(res => {
					this.list = res;
					this.detail = res[0]
				}).catch(err => {})
			}
		},
	}
</script>

<style>
</style>
